import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/http/bean/wroks/customers_copyInfo.dart';
import 'package:app/src/ui/app_ui.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';
import 'package:app/src/utils/image_path_utils.dart';

///派工审核：申请信息
class UiDispatchingauditInfo {
  ///data 客户信息
  ///oldData 历史客户信息
  static Widget build(
      BuildContext context, ContractCopyInfo? data, ContractCopyInfo? oldData) {
    if (StringUtils.isEmpty(data)) {
      return AppUi.getEmptyView();
    }
    List<Widget> children = [];
    children.add(UiBase.title(
        context, AppStrings.of(context).ApplicationInfo)); //标题：申请信息
    // children.add(UiBase.item(
    //     context,
    //     AppStrings.of(context).ApplicationTypeName,
    //     data?.ApplicationTypeName,
    //     oldData?.ApplicationTypeName)); //申请类型
    children.add(UiBase.item(
        context,
        AppStrings.of(context).ApplicationTypeName2,
        data?.ApplicationTypeName,
        oldData?.ApplicationTypeName)); //分配类型
    children.add(UiBase.item(
        context,
        AppStrings.of(context).Dispatchtype,
        data?.DispatchTypeName,
        oldData?.DispatchTypeName)); //派工类型
    children.add(UiBase.item(context, AppStrings.of(context).PersonName4,
        data?.PersonName, oldData?.PersonName)); //申请员工
    children.add(UiBase.item(
        context,
        AppStrings.of(context).ApplicationClassName,
        data?.ApplicationClassName,
        oldData?.ApplicationClassName)); //申请班组
    children.add(UiBase.item(context, AppStrings.of(context).AddDate5,
        data?.AddDate, oldData?.AddDate)); //申请日期
    // children.add(UiBase.item(context, AppStrings.of(context).Amount5,
    //     data?.Amount, oldData?.Amount)); //申请金额

    children.add(UiBase.itemWithEdit(
        context, AppStrings.of(context).Amount5, data?.Amount, oldData?.Amount,
        isChangeColor: false,
        isNumber: true,
        isEmpty: true,
        isDecimal: true, onChanged: (value) {
      data?.Amount = value;
    })); //申请金额

    children.add(UiBase.item(context, AppStrings.of(context).OnWorkTime2,
        data?.OnWorkTime, oldData?.OnWorkTime)); //班次开始
    children.add(UiBase.item(context, AppStrings.of(context).OffWorkTime2,
        data?.OffWorkTime, oldData?.OffWorkTime)); //班次结束
    children.add(UiBase.item(context, AppStrings.of(context).WorkingHours,
        data?.WorkingHours, oldData?.WorkingHours)); //申请工时
    children.add(UiBase.item(context, AppStrings.of(context).ApplyForReason,
        data?.ApplyForReason, oldData?.ApplyForReason)); //申请原因
    children.add(UiBase.item(context, AppStrings.of(context).RelatedAttendance,
        data?.RelatedAttendance, oldData?.RelatedAttendance,isHtml: true)); //相关出勤
    var column = UiBase.column(context, children);
    var card = UiCard.build(context, column);
    return card;
  }
}
